﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gurucore.Framework.DataAccess;
using Gurucore.Framework.DataAccess.Persistence;

namespace #class.Namespace#
{
	public class #class.Name#_Proxy : #class.Name#, IManageableDTO
	{
		<ad:foreach collection="#properties#" var="property">
		##region #property.Name#
		public #property.PropertyType# _#property.Name#
		{
			get { return base.#property.Name#; }
			set { base.#property.Name# = value; }
		}

		private DTOColumnState m_e#property.Name#State = DTOColumnState.Null;

		public DTOColumnState _#property.Name#State
		{
			get { return m_e#property.Name#State; }
			set { m_e#property.Name#State = value; }
		}

		public override #property.PropertyType# #property.Name#
		{
			get { return base.#property.Name#; }
			set
			{
				m_e#property.Name#State = DTOColumnState.Changed;
				base.#property.Name# = value;
			}
		}
		##endregion
		</ad:foreach>
		
		public DTOColumnState GetColumnState(string p_sColumn)
		{
			switch (p_sColumn)
			{
				<ad:foreach collection="#properties#" var="property">
				case "#property.Name#":
					return m_e#property.Name#State;
				</ad:foreach>
				default: 
					return DTOColumnState.Unchanged;
			}
		}

		public void SetColumnState(string p_sColumn, DTOColumnState p_eState)
		{
			switch (p_sColumn)
			{
				<ad:foreach collection="#properties#" var="property">
				case "#property.Name#":
					m_e#property.Name#State = p_eState;
					return;
				</ad:foreach>
			}
		}
		
	}
}
